using System;
using Unity.VisualScripting;
using UnityGameFramework.Runtime;

namespace LS.UGFUnits
{
    public class HideEntity_Id : EntityUnit
    {
        [DoNotSerialize]
        public ValueInput SerialId { get; set; }
        protected override void Definition()
        {
            base.Definition();
            SerialId = ValueInput<int>(nameof(SerialId));
            Requirement(SerialId, Input);
        }

        protected override ControlOutput In(Flow flow)
        {
            int serialId = flow.GetValue<int>(SerialId);
            Target?.HideEntity(serialId);
            return base.In(flow);
        }
    }
    
    public class HideEntity_Instance : EntityUnit
    {
        [DoNotSerialize]
        public ValueInput Entity { get; set; }
        protected override void Definition()
        {
            base.Definition();
            Entity = ValueInput<Entity>(nameof(Entity));
            Requirement(Entity, Input);
        }

        protected override ControlOutput In(Flow flow)
        {
            Entity entity = flow.GetValue<Entity>(Entity);
            Target?.HideEntity(entity);
            return base.In(flow);
        }
    }
}